import mqtt from '../../utils/mqtt.min.js';
const Logger = require('../../utils/logger');

Page({
  onClick_doorCtrl: function({ currentTarget: { dataset } }) {
    const devid = dataset.devid;
    this.logger.log(JSON.stringify(dataset));
    wx.navigateTo({
      url: '../doorCtrlDemo/doorCtrl?devid='+devid,
    })
 
  },
  onClick_SGW_EC_Ctrl: function({ currentTarget: { dataset } }) {
    const devid = dataset.devid;
    wx.navigateTo({
      url: '../Sgw_ec_CtrlDemo/Sgw_ec_Ctrl?devid='+devid,
    })
  },
  onLoad:function(options){
    this.logger = new Logger(this);

    this.logger.log('Onload:'+options.devid);
    const systemInfo = wx.getSystemInfoSync();
    this.logger.log(systemInfo);
    if (systemInfo.platform !== 'devtools') {
      wx.setEnableDebug({ enableDebug: true });
      wx.onNetworkStatusChange(res => {
        this.logger.log('网络变化:', res);
      });
    }
    wx.login({
      success:(res)=>{
        this.logger.log(res);
      }
    })
  }
})